//
//  DYZCarSourceDetailController.m
//  DYZCars
//
//  Created by jdc on 16/8/19.
//  Copyright © 2016年 MF. All rights reserved.
//

#import "DYZCarSourceDetailController.h"
static NSString *headerCellId = @"normalCellId";
static NSString *detailCellId = @"detailCellId";
static NSString *connectCellId = @"connectCellId";

@interface DYZCarSourceDetailController ()
@end

@implementation DYZCarSourceDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
}
-(void)setupUI{
    //注册单元格
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:headerCellId];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:detailCellId];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:connectCellId];
    //设置自动行高
    self.tableView.estimatedRowHeight = UITableViewAutomaticDimension;
}
#pragma mark -UITableViewDataSource
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
        return 2;
    }
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
        if (section==0) {
            return 6;
        }else{
            return 2;
        }
    }
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==0) {
        if (indexPath.row==0) {
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:headerCellId forIndexPath:indexPath];
            return cell;
        }else{
            tableView.rowHeight = 60;
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:detailCellId forIndexPath:indexPath];
            return cell;
            }
       }else {
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:connectCellId forIndexPath:indexPath];
            tableView.rowHeight = 100;
           return cell;
        }
           }
#pragma mark -UITableViewDelegate
    -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
        //获取indexPath
        NSIndexPath *indexPath = [[NSIndexPath alloc]initWithIndex:section];
        if (indexPath.section == 0) {//第一组
            return 0;
            
        }else
            return 60;
    }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
